<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<header th:replace="admin/header::header-fragment"></header>
<body class="hold-transition sidebar-mini">
<link rel="stylesheet" th:href="@{/admin/plugins/editormd/css/editormd.css}"/>
<link rel="stylesheet" th:href="@{/admin/plugins/tagsinput/jquery.tagsinput.css}"/>
<link rel="stylesheet" th:href="@{/admin/plugins/select2/select2.css}"/>
<div class="wrapper">
    <!-- 引入页面头header-fragment -->
    <div th:replace="admin/header::header-nav"></div>
    <!-- 引入工具栏sidebar-fragment -->
    <div th:replace="admin/sidebar::sidebar-fragment(${path})"></div>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <div class="container-fluid">
            </div><!-- /.container-fluid -->
        </div>
        <!-- Main content -->
        <div class="content">
            <div class="container-fluid">
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title">发布文章</h3>
                    </div>
                    <div class="card-body">
                        <!-- 几个基础的输入框，名称、分类等输入框 -->
                        <form id="blogForm" onsubmit="return false;">
                            <div class="form-group" style="display:flex;">
                                <input id="blogId" name="blogId"
                                       th:value="${blog!=null and blog.blogId!=null }?${blog.blogId}: 0"
                                       type="hidden">
                                <input class="form-control col-sm-6" id="blogName" name="blogName"
                                       placeholder="*请输入文章标题(必填)"
                                       required="true"
                                       th:value="${blog!=null and blog.blogTitle!=null }?${blog.blogTitle}: ''"
                                       type="text">
                                &nbsp;&nbsp;
                                <input class="form-control" id="blogTags" name="blogTags" placeholder="请输入文章标签"
                                       style="width: 100%;"
                                       th:value="${blog!=null and blog.blogTags!=null }?${blog.blogTags}: ''"
                                       type="text">
                            </div>
                            <div class="form-group" style="display:flex;">
                                <input class="form-control col-sm-6" id="blogSubUrl" name="blogSubUrl"
                                       placeholder="请输入自定义路径,如:springboot-mybatis,默认为id"
                                       th:value="${blog!=null and blog.blogSubUrl!=null }?${blog.blogSubUrl}: ''"
                                       type="text"> &nbsp;&nbsp;
                                <select class="form-control select2" data-placeholder="请选择分类..." id="blogCategoryId"
                                        style="width: 100%;">
                                    <th:block th:if="${null == categories}">
                                        <option selected="selected" value="0">默认分类</option>
                                    </th:block>
                                    <th:block th:unless="${null == categories}">
                                        <th:block th:each="c : ${categories}">
                                            <option th:selected="${null !=blog and null !=blog.blogCategoryId and blog.blogCategoryId==c.categoryId} ?true:false"
                                                    th:text="${c.categoryName}"
                                                    th:value="${c.categoryId}">
                                                >
                                            </option>
                                        </th:block>
                                    </th:block>
                                </select>
                            </div>
                            <div class="form-group" id="blog-editormd">
                                <textarea style="display:none;"
                                          th:utext="${blog!=null and blog.blogContent !=null}?${blog.blogContent}: ''"></textarea>
                            </div>
                            <div class="form-group">
                                <!-- 按钮 -->
                                &nbsp;<button class="btn btn-info float-right" id="confirmButton"
                                              style="margin-left: 5px;">保存文章
                            </button>&nbsp;
                                &nbsp;<button class="btn btn-secondary float-right" id="cancelButton"
                                              style="margin-left: 5px;">返回文章列表
                            </button>&nbsp;
                            </div>
                        </form>
                    </div>

                </div>
            </div><!-- /.container-fluid -->
        </div>
        <div class="content">
            <!-- 模态框（Modal） -->
            <div aria-labelledby="articleModalLabel" class="modal fade" id="articleModal" role="dialog" tabindex="-1">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button aria-label="Close" class="close" data-dismiss="modal" type="button"><span
                                    aria-hidden="true">&times;</span></button>
                            <h6 class="modal-title" id="articleModalLabel">信息完善</h6>
                        </div>
                        <div class="modal-body">
                            <form onsubmit="return false;">
                                <div class="form-group">
                                    <div class="col-sm-4">
                                        <th:block th:if="${null == blog}">
                                            <img id="blogCoverImage" src="/admin/dist/img/img-upload.png"
                                                 style="height: 64px;width: 64px;">
                                        </th:block>
                                        <th:block th:unless="${null == blog}">
                                            <img id="blogCoverImage" style="width:160px ;height: 120px;display:block;"
                                                 th:src="${blog.blogCoverImage}">
                                        </th:block>
                                    </div>
                                </div>
                                <br>
                                <div class="form-group">
                                    <div class="col-sm-4">
                                        <button class="btn btn-info" id="uploadCoverImage" style="margin-bottom: 5px;">
                                            <i class="fa fa-picture-o"></i>&nbsp;上传封面
                                        </button>
                                        <button class="btn btn-secondary" id="randomCoverImage"
                                                style="margin-bottom: 5px;"><i
                                                class="fa fa-random"></i>&nbsp;随机封面
                                        </button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label">文章状态:&nbsp;</label>
                                    <input checked=true id="publish" name="blogStatus"
                                           th:checked="${null==blog||(null !=blog and null !=blog.blogStatus and blog.blogStatus==1)} ?true:false"
                                           type="radio"
                                           value="1"/>&nbsp;发布&nbsp;
                                    <input id="draft" name="blogStatus"
                                           th:checked="${null !=blog and null !=blog.blogStatus and blog.blogStatus==0} ?true:false"
                                           type="radio"
                                           value="0"/>&nbsp;草稿&nbsp;
                                </div>
                                <div class="form-group">
                                    <label class="control-label">是否允许评论:&nbsp;</label>
                                    <input checked=true id="enableCommentTrue" name="enableComment"
                                           th:checked="${null==blog||(null !=blog and null !=blog.enableComment and blog.enableComment==0)} ?true:false"
                                           type="radio"
                                           value="0"/>&nbsp;是&nbsp;
                                    <input id="enableCommentFalse" name="enableComment"
                                           th:checked="${null !=blog and null !=blog.enableComment and blog.enableComment==1} ?true:false"
                                           type="radio"
                                           value="1"/>&nbsp;否&nbsp;
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-default" data-dismiss="modal" type="button">取消</button>
                            <button class="btn btn-primary" id="saveButton" type="button">确认</button>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.modal -->
        </div>
    </div>
    <!-- /.content-wrapper -->
    <!-- 引入页脚footer-fragment -->
    <div th:replace="admin/footer::footer-fragment"></div>
</div>
<!-- jQuery -->
<script th:src="@{/admin/plugins/jquery/jquery.min.js}"></script>
<!-- jQuery UI 1.11.4 -->
<script th:src="@{/admin/plugins/jQueryUI/jquery-ui.min.js}"></script>
<!-- Bootstrap 4 -->
<script th:src="@{/admin/plugins/bootstrap/js/bootstrap.bundle.min.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/admin/dist/js/adminlte.min.js}"></script>
<!-- editor.md -->
<script th:src="@{/admin/plugins/editormd/editormd.min.js}"></script>
<!-- tagsinput -->
<script th:src="@{/admin/plugins/tagsinput/jquery.tagsinput.min.js}"></script>
<!-- Select2 -->
<script th:src="@{/admin/plugins/select2/select2.full.min.js}"></script>
<!-- sweetalert -->
<script th:src="@{/admin/plugins/sweetalert/sweetalert.min.js}"></script>
<!-- ajaxupload -->
<script th:src="@{/admin/plugins/ajaxupload/ajaxupload.js}"></script>
<script th:src="@{/admin/dist/js/public.js}"></script>
<script th:src="@{/admin/dist/js/edit.js}"></script>
</body>
</html>
